 CROSS_COMPILE ?= arm-none-eabi-
 
 TARGET ?= ledc
   
 CC :=$(CROSS_COMPILE)gcc
 LD :=$(CROSS_COMPILE)ld
 OBJCOPY :=$(CROSS_COMPILE)objcopy
 OBJDUMP :=$(CROSS_COMPILE)objdump


objs := start2.o main.o
   
$(TARGET).bin:$(objs)
	$(LD)   -T stm32_flash.lds -o $(TARGET).elf $^
	$(OBJCOPY) -O binary -S $(TARGET).elf  $@
	$(OBJDUMP) -D -m arm  $(TARGET).elf > $(TARGET).dis

%.o:%.s
	$(CC) -Wall -c  -march=armv7-m -o $@ $<
%.o:%.S
	$(CC) -Wall -c  -march=armv7-m  -o $@ $<
%.o:%.c
	$(CC) -Wall -c  -march=armv7-m  -o $@ $<

clean:
	rm -rf *.o  $(TARGET).bin  $(TARGET).elf  $(TARGET).dis



